main(a,b,c,d,t,l)
{
	char s[7];
	for(gets(s);gets(s);printf("%d/%d\n",a,b))
	{
		sscanf(s,"0.%d",&l);
		b=pow(10,strlen(s)-2);
		a=l;

		c=a;
		d=b;
		do
		{
			t=c%d;
			c=d;
			d=t;
		}while(t);
		a/=c;
		b/=c;
	}
}
